跳到主要内容

首尾帧生视频

更新时间:2026-01-13 11:32:15
根据首尾帧图片生成视频,仅支持异步模式。调用该接口前,您需要先通过调用「上传文件」接口获取输入的原图路径;调用该接口后,您可通过调用「查询任务生成结果」接口获取视频的生成结果。
POST
https://cloud.baicaiinfer.com/v1/videos/generations
Authorizations
AuthorizationsStringHeaderRequired

用户需使用已获取的API Key进行身份验证,以访问服务。

Body
application/json
selected_modelStringRequired

模型名称,取值:Viduq2-pro-FLF2V-fast。更多模型,可参考支持的模型和应用

task_typeStringRequired

指定生成式模型需执行的任务类型,取值:flf2video。更多任务类型,可参考支持的模型和应用

inputObjectRequired

输入参数集合。

input.imageStringRequired

首帧图(支持png、jpg格式)。

input.last_imageStringRequired

尾帧图(支持png、jpg格式)。

input.promptStringRequired

是生成视频时用于描述期望内容(如场景、风格、细节等)的正向提示词。

input.negative_promptString

用于指定生成视频时需避免的元素(如低质量、失真等)的反向提示词,以优化生成结果的质量。

input.resolutionStringRequired

分辨率(取值:720p、1080p)。

input.aspect_ratioString

无需指定,以输入的首帧图的宽高比输出。

input.durationIntRequired

视频时常(取值:5、6、8),单位s。

input.number_of_videosInt

指定生成视频的数量,取值范围为1~4。默认值:1。

need_expand_promptBoolean

优化提示词(取值:true、false),默认值:false。

asyncBoolean

采用异步方式处理请求,默认值:true。

Response
状态码:application/json
codeIntRequired

表示请求处理状态的状态码。

0是成功标识,表示接口正常返回预期结果。
messageStringRequired

返回请求的处理结果,通常配合状态码使用,直观告知用户当前请求的具体情况。

dataobjectRequired

任务的核心结果数据。

data.taskIdStringRequired

任务的唯一标识ID。

tsStringRequired

响应的时间戳。

curl --location --request POST 'https://cloud.baicaiinfer.com/v1/videos/generations' \
--header 'Authorization: Bearer sk-VStOhW7gwGTcy5lFuDg*****' \
--header 'Content-Type: application/json' \
--data-raw '{
    "selected_model": "Viduq2-pro-FLF2V-fast",
    "task_type": "flf2video",
    "input": {
         "image": "https://s1.llamafactory.online/baicai-infer/users/7e4113a5a1284465831eaefaa0022a98/12.png",
         "prompt": "小狗起身轻嗅,镜头转场到午后乐园,男孩笑着奔向镜头,阳光与绿意贯穿始终。",
         "resolution": "1080p",
         "duration": 5,
         "last_image": "https://s1.llamafactory.online/baicai-infer/users/7e4113a5a1284465831eaefaa0022a98/13.png"
    }
 }'
{
    "code": 0,
    "message": "任务提交成功",
    "data": {
        "taskId": "3524e0b3ba014b12ab1faf29f9f*****"
    },
    "ts": "2026-02-02T10:44:54.716004004+08:00[Asia/Shanghai]"
}